package org.zhouhe.modules.website;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.zhouhe.base.BaseAction;
import org.zhouhe.modules.industry.service.IndustryService;
import org.zhouhe.modules.servingProcess.service.ServingProcessService;
import org.zhouhe.vo.Article;
import org.zhouhe.vo.HotInfo;
import org.zhouhe.vo.Industry;
import org.zhouhe.vo.ServingProcess;

public class IndexAction extends BaseAction {

	private static final long serialVersionUID = -8838235045036422162L;
	@Autowired
	private IndustryService industryService;
	@Autowired
	private ServingProcessService servingProcessService;
	private List<Industry> industryList;
	private Industry paramIndustry = new Industry();
	private Integer industryId;
	private List<Article> articleByTypeList;
	private List<ServingProcess> servingProcessList;
	private String imageUrls;
	private String imageLinks;
	private List<HotInfo> hotInfoList;
	private String title;
	public String index() {
//		industryList = (List<Industry>) servletContext.getAttribute(Constant.APPLICATION_KEY_INDUSTRY_LIST);
//		ActionContext ctx = ActionContext.getContext();       
//		HttpServletRequest request = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST);
//		//新闻咨讯：
//		articleByTypeList = articleService.getArticleByType(1, null, 11);
//		//热点动态：
//		hotInfoList = hotInfoService.getHotInfoByType(null, 3);
//		//报告图片幻灯：
//		List<Report> rptList4Image = reportService.getReportsRecoByImage(null, null, 4);
//		imageUrls = "";
//		imageLinks = "";
//		for(Report rpt : rptList4Image){
//			imageUrls += "|" + rpt.getImgName();
//			imageLinks += "|report.action?report.reportId=" + rpt.getReportId();
//		}
//		if(imageUrls.length() > 0){
//			imageUrls = imageUrls.substring(1);
//			imageLinks = imageLinks.substring(1);
//		}
		servingProcessList = servingProcessService.getServingProcessList();
		return "index";
	}

	public String i1(){
		//热点动态：
//		hotInfoList = hotInfoService.getHotInfoByType(null, 3);
		servingProcessList = servingProcessService.getServingProcessList();
		Industry industry = industryService.getIndustryById(industryId);
		this.setPageTitle(industry.getName());
		return "i1";
	}
	
	public String i2(){

		Industry industry = industryService.getIndustryById(industryId);
		this.setPageTitle(industry.getName() +" - "+ industry.getIndustry().getName());
		return "i2";
	}

	public IndustryService getIndustryService() {
		return industryService;
	}

	public void setIndustryService(IndustryService industryService) {
		this.industryService = industryService;
	}

	public List<Industry> getIndustryList() {
		return industryList;
	}

	public void setIndustryList(List<Industry> industryList) {
		this.industryList = industryList;
	}



	public void setTitle(String title) {
		this.title = title;
	}



	public String getTitle() {
		return title;
	}



	public void setArticleByTypeList(List<Article> articleByTypeList) {
		this.articleByTypeList = articleByTypeList;
	}



	public List<Article> getArticleByTypeList() {
		return articleByTypeList;
	}



	public void setHotInfoList(List<HotInfo> hotInfoList) {
		this.hotInfoList = hotInfoList;
	}



	public List<HotInfo> getHotInfoList() {
		return hotInfoList;
	}

	public void setImageUrls(String imageUrls) {
		this.imageUrls = imageUrls;
	}

	public String getImageUrls() {
		return imageUrls;
	}

	public void setImageLinks(String imageLinks) {
		this.imageLinks = imageLinks;
	}

	public String getImageLinks() {
		return imageLinks;
	}

	public void setServingProcessList(List<ServingProcess> servingProcessList) {
		this.servingProcessList = servingProcessList;
	}

	public List<ServingProcess> getServingProcessList() {
		return servingProcessList;
	}

	public void setParamIndustry(Industry paramIndustry) {
		this.paramIndustry = paramIndustry;
	}

	public Industry getParamIndustry() {
		return paramIndustry;
	}

	public void setIndustryId(Integer industryId) {
		this.industryId = industryId;
	}

	public Integer getIndustryId() {
		return industryId;
	}

}
